package com.anpy.bill.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * 家庭日历实体类
 */
@Data
@TableName(value = "T_DATE_LINE")
@ApiModel(description = "家庭日历信息")
public class DateLineEntity {

    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "日历事件ID", example = "1")
    private Long id;

    @TableField(value = "title")
    @ApiModelProperty(value = "事件标题", example = "家庭聚餐")
    private String title;

    @TableField(value = "event_type_id")
    @ApiModelProperty(value = "事件类型ID", example = "1")
    private Long eventTypeId;

    @TableField(value = "location")
    @ApiModelProperty(value = "事件地点", example = "家里")
    private String location;

    @TableField(value = "event_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "事件时间", example = "2025-02-27 18:00:00")
    private Date eventTime;

    @TableField(value = "user_id")
    @ApiModelProperty(value = "用户ID", example = "1")
    private Integer userId;

    @TableField(value = "description")
    @ApiModelProperty(value = "事件描述", example = "全家人一起吃饭")
    private String description;

    @TableField(value = "created_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间", example = "2025-02-27 15:00:00")
    private Date createdAt;

    @TableField(value = "updated_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间", example = "2025-02-27 15:00:00")
    private Date updatedAt;

    // 关联的事件类型信息（非数据库字段）
    @TableField(exist = false)
    @ApiModelProperty(value = "事件类型信息")
    private DateLineTypeEntity eventType;

    // 关联的图片列表（非数据库字段）
    @TableField(exist = false)
    @ApiModelProperty(value = "事件图片列表")
    private List<PhotoEntity> photos;
}
